﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace Ruleweaver.Rules.CheckMethods
{
	public sealed class IsLessThanOrEqualToMethod : ComparisonMethod
	{
		private readonly object _value;

		public IsLessThanOrEqualToMethod(object value)
		{
			_value = value;
		}

		protected override MethodInfo GetMethod(Type targetType, Type checkType)
		{
			return typeof(Checkable).GetMethod("IsLessThanOrEqualTo").MakeGenericMethod(targetType);
		}

		protected override IEnumerable<object> GetCheckArguments(Type targetType)
		{
			yield return _value;
		}
	}
}